package com.ccsoft.netty.chatroom;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

/**
 * @author chanchaw
 * @create 2022-07-18 14:29
 */
public class ServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        pipeline.addLast("stringDecoder",new StringDecoder());
        pipeline.addLast("stringEncoder",new StringEncoder());
        pipeline.addLast(new ServerHandler());
    }
}
